//
//  SearchServerTableViewCell.m
//  PYWGetColor
//
//  Created by 杜文杰 on 2018/6/13.
//  Copyright © 2018年 dwj. All rights reserved.
//

#import "SearchServerTableViewCell.h"
@interface SearchServerTableViewCell()
@property (nonatomic, strong) UIImageView *headerImageView;
@end

@implementation SearchServerTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.separatorInset = UIEdgeInsetsZero;
        
        [self.contentView addSubview:self.headerImageView];
        [self.contentView addSubview:self.titleLabel];
        UIView *lineView = [[UIView alloc]init];
        lineView.backgroundColor = getColor(dividerColor);
        [self.contentView addSubview:lineView];
        
        __weak typeof(self)weakself = self;
        [self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(weakself.mas_centerY);
            make.width.height.mas_offset(10 / WIDTH_6S_SCALE);
            make.left.equalTo(weakself.mas_left).offset(10 / WIDTH_6S_SCALE);
        }];
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(weakself.mas_centerY);
            make.left.equalTo(weakself.headerImageView.mas_right).offset(10 / WIDTH_6S_SCALE);
            make.height.mas_offset(20 / HEIGHT_6S_SCALE);
        }];
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(weakself.mas_bottom).offset(-1);
            make.left.right.equalTo(weakself);
            make.height.mas_offset(1);
        }];
        [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(weakself.headerImageView.mas_top).offset(-10 / HEIGHT_6S_SCALE);
            make.left.right.equalTo(weakself);
            make.bottom.equalTo(weakself.titleLabel.mas_bottom).offset(10 / HEIGHT_6S_SCALE);
        }];
        
    }
    return self;
}
#pragma mark - init
- (UIImageView *)headerImageView
{
    if (!_headerImageView) {
        _headerImageView = [[UIImageView alloc]init];
        _headerImageView.backgroundColor = [UIColor clearColor];
        _headerImageView.image = [UIImage imageNamed:@"ip"];
    }
    return _headerImageView;
}
- (UILabel *)titleLabel
{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc]initWithFrame:CGRectZero];
        _titleLabel.backgroundColor = [UIColor clearColor];
        _titleLabel.textColor = getColor(blackColor);
        _titleLabel.textAlignment = NSTextAlignmentLeft;
        _titleLabel.font = DEF_FontSize_14;
        [_titleLabel sizeToFit];
        _titleLabel.text = @"手机维修 > 苹果手机 > 苹果手机";
    }
    return _titleLabel;
}
@end

